//
//  WBNavigationBar.swift
//  ZWWEIBO
//
//  Created by xzw on 2018/4/3.
//  Copyright © 2018年 xzw. All rights reserved.
//

import UIKit

class WBNavigationBar: UINavigationBar {
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //注意导航栏及状态栏高度适配
        frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
        for view in subviews {
            let viewbg = subviews[0];//_UIBarBackground
            let viewcon = subviews[2];//_UINavigationBarContentView
            //print(view);
            if(view == viewbg){
                view.frame = bounds;
            }else if(view == viewcon){
                var frame = view.frame;
                frame.origin.y = 20;
                frame.size.height = self.bounds.size.height - frame.origin.y;
                view.frame = frame;
            }
        }  
       
    }  

}
